# from sqlalchemy import Column, Integer, String, DateTime, ForeignKey, Table
# from sqlalchemy.orm import relationship
# from base import Base
# from permissions import Permission
# from sqlalchemy.sql import func
#
#
# # 定义关联表
# role_permissions = Table(
#     'role_permissions', Base.metadata,
#     Column('role_id', Integer, ForeignKey('roles.id'), primary_key=True),
#     Column('permission_id', Integer, ForeignKey('permissions.id'), primary_key=True)
# )
#
# class Role(Base):
#     __tablename__ = 'roles'
#     id = Column(Integer, primary_key=True, index=True)
#     name = Column(String(255), unique=True, index=True, comment="角色名")
#     description = Column(String(255), comment="角色描述")
#     deleted_at = Column(DateTime(timezone=True), nullable=True, comment='删除时间')
#     created_at = Column(DateTime, server_default=func.now(), comment='创建时间')
#     updated_at = Column(DateTime, onupdate=func.now(), comment='更新时间')
#
#
# permissions = relationship('Permission', secondary=role_permissions, backref='roles')
